package main

import (
	"gin-easy/api/controller"
	"gin-easy/pkg/viper_config"
	"gin-easy/pkg/zap_log"
	"github.com/gin-gonic/gin"
)

func RouteInit() *gin.Engine {
	if !viper_config.Conf.AppDebug {
		gin.SetMode(gin.ReleaseMode)
	}
	r := gin.New()
	r.Use(zap_log.GinLogger(), zap_log.GinRecovery(true))
	user := r.Group("/user")
	{
		user.POST("/register", controller.UserRegister)
	}
	article := r.Group("/article")
	{
		article.POST("/set", controller.ArticleSet)
	}
	return r
}
